package com.cbd.common;

import lombok.Getter;

/**
 * cbd-management:
 * {@code @Description}  定义用户状态枚举类
 * {@code @Author}  Flowen~
 * {@code @Date&Time} 2024/11/28 3:16
 */
// 定义一个枚举类UserStatus，用来表示用户状态
@Getter
public enum UserStatus {
    PENDING(0), // 待验证
    ACTIVE(1);  // 活跃

    private final int value;

    UserStatus(int value) {
        this.value = value;
    }

    public static UserStatus fromValue(int value) {
        for (UserStatus status : UserStatus.values()) {
            if (status.value == value) {
                return status;
            }
        }
        throw new IllegalArgumentException("不存在的用户状态值: " + value);
    }
}
